package com.ecco.persistent;

import java.util.Collection;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "account", catalog = "ecco_demo", uniqueConstraints = {})

public class Account implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1955263696573646503L;
	
	// Fields
	private Integer acc_id;
	private String acc_name;
	private String contact;
	private String phone;
	private String email;
	private Date date;
	private Collection<AccObCol> aocRecords;
	
	// Constructors
	public Account() { 	}
	
	/** minimal constructor */
	public Account(Integer acc_id) {
		this.acc_id = acc_id;
	}
	
	/** full constructor */
	public Account(Integer acc_id, String acc_name, String contact, String phone,
			String email, Date date) {
		this.acc_id = acc_id;
		this.acc_name = acc_name;
		this.contact = contact;
		this.phone = phone;
		this.email = email;
		this.setDate(date);
	}
	
	//	 Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ACC_ID")
	public Integer getAcc_id() {
		return this.acc_id;
	}
	
	public void setAcc_id(Integer acc_id) {
		this.acc_id = acc_id;
	}
	
	@Column(name = "ACC_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 30)
	public String getAcc_name() {
		return this.acc_name;
	}

	public void setAcc_name(String acc_name) {
		this.acc_name = acc_name;
	}
	
	@Column(name = "CONTACT", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public String getContact() {
		return this.contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}
	
	@Column(name = "PHONE", unique = false, nullable = true, insertable = true, updatable = true, precision = 12, scale = 0)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@Column(name = "EMAIL", unique = false, nullable = true, insertable = true, updatable = true, length = 35)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(name = "DATE", unique = false, nullable = true, insertable = true, updatable = true)
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@OneToMany(mappedBy="account",cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Collection<AccObCol> getAocRecords(){
	return aocRecords;
	}
	
	public void setAocRecords(Collection<AccObCol> aocRecords) {
		this.aocRecords = aocRecords;
	}

}
